// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-8-26

#ifndef __REFDATA_H_COMMON_BASE__
#define __REFDATA_H_COMMON_BASE__

#pragma once

#include "thread.h"

//##ModelId=44CF175703B0
class CJoyRefData
{
protected:
	//##ModelId=44CF175703BA
    CJoyAtomCount    m_nRef;
public:
	//##ModelId=44CF175703BE
    CJoyRefData(void)
        : m_nRef(1)
    {
    }
	//##ModelId=44CF175703C0
    virtual ~CJoyRefData(void)
    {
    }

	//##ModelId=44CF175703C8
    LONG AddRef()
    {
        return ++m_nRef;
    }
	//##ModelId=44CF175703C9
    LONG Release()
    {
        LONG nRef = --m_nRef;
        if(nRef == 0)
        {
            delete this;
        }
        return nRef;
    }
};

#endif  // __REFDATA_H_COMMON_BASE__
